Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PulseAudio: Use default sink at multiple sink environment #9

Merged
merged 5 commits into from
Apr 21, 2020

Conversation

aquahika
Copy link
Contributor

@aquahika aquahika commented Mar 20, 2020

At the original code, A PulseAudio command forced to use sink 0 for controlling/fetching volume.
The following changes allow using default sink at multiple audio sink environments. (mostly user selected on their gui/ in the case of only one sink available, pa will use it as default sink )

  • Use @DEFAULT_SINK@ for pactl set-sink* commands instead of sink 0.
  • Use pactl info to fetch default sink.

@itchyny
Copy link
Owner

itchyny commented Mar 22, 2020

Please confirm the CI.

volume_linux.go Outdated
}

var volumePattern = regexp.MustCompile(`\d+%`)

func parseVolume(out string) (int, error) {
lines := strings.Split(out, "\n")
pa_default_sink_hooked := false
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer using camelCase in Golang.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. 90441c9

Library Protocol Version: 32
Server Protocol Version: 32
Is Local: no
Client Index: 248
Tile Size: 65472
User Name: hikaru
Host Name: hikaru-thinkpad
Server Name: pulseaudio
Server Version: 11.1
Default Sample Specification: s16le 2ch 44100Hz
Default Channel Map: front-left,front-right
Default Sink: MySink
Default Source: alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
Cookie: 6325:d303
@itchyny
Copy link
Owner

itchyny commented Apr 21, 2020

Thank you.

@itchyny itchyny merged commit 99c3b4a into itchyny:master Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants